<template>
  <div style="padding-top: 3vw">
    <div class="searchCom">
      <div>
        <img src="/static/img/sousuo.png" alt="" style="left:16px">
        <input type="text" v-model="searchContent">
        <img src="/static/img/quxiao.png" alt="" style="right: 10px" @click="quxiao">
      </div>
      <button @click="search">搜索</button>
    </div>
  </div>
</template>

<script>
  import request from '@/actions/request.js'
  export default {
    name: "searchCom",
    components: {
    },
    data() {
      return {
        searchContent:''
      }
    },
    props:['keyWord'],
    watch:{

    },
    onShow(){
      this.searchContent = ''
    },
    methods:{
      quxiao(){
        this.searchContent=''
      },
      search:function(){
        if(this.searchContent){
          this.$emit('keyword',this.searchContent)
        }
      }
    },
    mounted() {
      this.searchContent=this.keyWord;
    },
  }
</script>

<style scoped lang="scss">
  .searchCom{
    font-size: 15px;
    padding: 0 4vw;
    >div{
      position: relative;
      height: 30px;
      width: 75vw;
      display: inline-block;
      border-radius: 100px;
      background: #f5f5f5;
      overflow: hidden;
    }
    input{
      width: 55vw;
      padding-left: 42px;
      height:100%;
      background: #f5f5f5;
    }
    img{
      width:16px;
      height: 16px;
      position: absolute;
      top: 7px;
    }
    button{
      float:right;
      background: #ffffff;
      color: #333333;
      line-height: 30px;
      font-size: 15px;
    }
  }
</style>
